package com.victor9ac.tfm.twitter.adapter;

import java.util.List;

import twitter4j.Status;

import com.victor9ac.tfm.provider.api.Comment;
import com.victor9ac.tfm.provider.api.CommentSource;
import com.victor9ac.tfm.provider.api.Commentaries;

public class TwitterAdapter {

	public Comment adapter(Status status) {
		Comment comment = null;
		if (status != null) {
			comment = new Comment(status.getUser().getName(), status.getText(),
					status.getCreatedAt(),CommentSource.TWITTER);
			
		}
		return comment;
	}

	public Commentaries adapter(List<Status> status) {
		Commentaries commentaries = null;
		if (status != null && status.size() > 0) {
			commentaries = new Commentaries();
			for (Status currentStatus : status) {
				commentaries.add(this.adapter(currentStatus));
			}
		}
		return commentaries;
	}

}
